Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update sysinfo and fix fd leak on linux #4163

Merged
merged 2 commits into from
Sep 3, 2024

Conversation

fraidev
Copy link
Contributor

@fraidev fraidev commented Sep 2, 2024

Update sysinfo to 0.31.4 and fix file descriptor leak on Linux.
sysinfo leaks file descriptors on Linux if the limit is not set.

Spu Before:

▷ ls /proc/570230/fd/ | wc -l
1114

Spu After:

▷ ls /proc/574099/fd/ | wc -l
19

@fraidev fraidev force-pushed the fix_system_fd_leak branch 2 times, most recently from 50cea01 to c29b008 Compare September 2, 2024 21:48
@fraidev fraidev marked this pull request as ready for review September 2, 2024 21:50
let process_name = process.name().to_str();

if let Some(process_name) = process_name {
if process_name.contains("fluvio") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you make fluvio as constant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

let mut sys = System::new();
sys.refresh_processes(); // Only load what we need.
for process in sys.processes_by_exact_name(name) {
sys.refresh_processes(sysinfo::ProcessesToUpdate::All); // Only load what we need.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems like repeating. can you change into common util?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure! I created a process mod.

Copy link
Contributor

@sehz sehz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Couple of minor nits

@fraidev fraidev requested a review from sehz September 3, 2024 00:16
@fraidev fraidev added this pull request to the merge queue Sep 3, 2024
Merged via the queue into infinyon:master with commit 5e97695 Sep 3, 2024
104 checks passed
@fraidev fraidev deleted the fix_system_fd_leak branch September 3, 2024 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants